Skip to content

test: set default delay to 0.05s for wait_until in functional tests #6631

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from

Conversation

knst
Copy link
Collaborator

@knst knst commented Apr 15, 2025

Issue being fixed or feature implemented

Waiting for 0.5s in functional test for every action is a bit excessive, especially for p2p tests that sending messages by localnetwork and waiting at least 0.5 seconds before checking if message is received.

What was done?

Decreasing default delay from 0.5s to 0.05s. It affects mostly p2p tests, but many other tests become faster too.
For quorum formation; for sporks and some other dash specific features bigger delays (0.5s, 1s) are used.

Further improvements are blocked by #6673, #6672, #6671 and are out of scope this PR.

How Has This Been Tested?

Speed up on CI for 30% and more.

[develop] linux64-test https://gitlab.com/dashpay/dash/-/jobs/10049432489
ALL | ✓ Passed | 7241 s (accumulated)
Runtime: 1272 s
[PR] linux64-test https://gitlab.com/dashpay/dash/-/jobs/10067158169
ALL | ✓ Passed | 5421 s (accumulated)
Runtime: 938 s
-25%

[develop] linux64-nowallet https://gitlab.com/dashpay/dash/-/jobs/10049432511
ALL | ✓ Passed | 2739 s (accumulated)
Runtime: 488 s
[PR] linux64-nowallet https://gitlab.com/dashpay/dash/-/jobs/10067158174
ALL | ✓ Passed | 1232 s (accumulated)
Runtime: 243 s
-49%

[develop] linux64-tsan https://gitlab.com/dashpay/dash/-/jobs/10049432499
ALL | ✓ Passed | 10399 s (accumulated)
Runtime: 2023 s
[PR] linux64-tsan https://gitlab.com/dashpay/dash/-/jobs/10072993489
ALL | ✓ Passed | 8710 s (accumulated)
Runtime: 1543 s
-25%

[develop] Functional tests on localhost (-O3, debug, no sanitizers, -j20):
ALL | ✓ Passed | 6680 s (accumulated)
Runtime: 372 s
[PR] Functional tests on localhost (-O3, debug, no sanitizers, -j20):
ALL | ✓ Passed | 4609 s (accumulated)
Runtime: 365 s
Benefits of running locally in 20 parallel jobs are very slight. Accumulated time is decreased for 32% as expected, but total time is improved less than 2%.
It is because the slowest tests requires many quorums to be formed and they are still slow.

Breaking Changes

N/A

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have made corresponding changes to the documentation
  • I have assigned this pull request to a milestone

@knst knst force-pushed the test-mini-delays branch from c0faa06 to 4f3832e Compare April 22, 2025 10:38
PastaPastaPasta added a commit that referenced this pull request Apr 25, 2025
…waiting votes to be propagated

be9cf82 test: fix intermittent failure in feature_governance.py waiting votes to be propagated (Konstantin Akimov)

Pull request description:

  ## Issue being fixed or feature implemented
  While implementing #6631 found instability in feature_governance.py

  ## What was done?
  Governance votes are not delivered instantly between notes. If any vote is delayed a bit the wrong amount of votes will be remembered and test will fail further when comparing its count.

  ## How Has This Been Tested?
  Tested locally with changes from #6631
  without them - 90+% probability feature_governance.py to fail, with them - no failure happens locally.

  ## Breaking Changes
  N/A

  ## Checklist:
  - [x] I have performed a self-review of my own code
  - [ ] I have commented my code, particularly in hard-to-understand areas
  - [ ] I have added or updated relevant unit/integration/functional/e2e tests
  - [ ] I have made corresponding changes to the documentation
  - [x] I have assigned this pull request to a milestone

ACKs for top commit:
  UdjinM6:
    utACK be9cf82

Tree-SHA512: 113f22314c1a269bfe804e8ad3f1aa02dd31155af08f073345bce52d93d23746cee543814f5b44791698e40eca843a747660fddf2a4eafb235c3b3044fe06ba6
@knst knst force-pushed the test-mini-delays branch 2 times, most recently from fd6ce4f to 1017a12 Compare May 12, 2025 17:52
@knst knst added this to the 23 milestone May 12, 2025
@knst knst force-pushed the test-mini-delays branch from 1017a12 to f7526ef Compare May 17, 2025 17:36
@knst knst marked this pull request as ready for review May 19, 2025 18:47
@knst knst requested review from PastaPastaPasta and UdjinM6 May 19, 2025 18:48
Copy link

coderabbitai bot commented May 19, 2025

Walkthrough

The changes adjust the polling intervals in wait loops within the test framework and related functional tests. The default sleep interval in the core wait_until and wait_until_helper functions is reduced from 0.5 seconds to 0.05 seconds, increasing polling frequency. Method signatures for wait_for_quorum_list and wait_for_quorums_list are updated to remove the sleep parameter, and their internal logic is simplified to direct state checks without mocktime or block generation steps. One test explicitly sets a 1-second sleep interval for a specific wait loop. No changes are made to the logic of the conditions being waited on.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f7526ef and 0d9418e.

📒 Files selected for processing (3)
  • test/functional/feature_mnehf.py (1 hunks)
  • test/functional/test_framework/test_framework.py (3 hunks)
  • test/functional/test_framework/util.py (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • test/functional/feature_mnehf.py
  • test/functional/test_framework/util.py
  • test/functional/test_framework/test_framework.py
✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@knst knst changed the title test: set 0.05s delay for wait_until in functional tests test: set default delay to 0.05s for wait_until in functional tests May 20, 2025
PastaPastaPasta added a commit that referenced this pull request May 20, 2025
b0dea8c test: extra logs for wait-for-CL and wait-for-IS (Konstantin Akimov)
49ae952 fix: intermittent error in feature_notification.py due to missing quorum for CL (Konstantin Akimov)
538687b fix: intermittent error in p2p_instantsend.py due to missing quorum for CL (Konstantin Akimov)
834d2f6 test: fix intermittert error in feature_asset_locks.py due to missing IS quorum (Konstantin Akimov)

Pull request description:

  ## Issue being fixed or feature implemented
  In functional test `feature_asset_locks.py` a quorum for InstantSend is not generated intentionally but usually it is enough time to be formed while other quorums are generated.
  Similar situation for `p2p_instantsend.py` and `feature_notifications.py`.

  This fix is one of the blockers for #6631 because with smaller delays extra quorums (beyond expected) almost never formed.

  Example of logs:

      2025-05-15T19:50:51.884000Z TestFramework (INFO): Test no IS for asset unlock...
      2025-05-15T19:50:52.892000Z TestFramework (INFO): Send tx with expected_error:'None'...
      2025-05-15T19:51:54.214000Z TestFramework.utils (ERROR): wait_until() failed. Predicate: ''''
              def check_instantlock():
                  self.bump_mocktime(1)
                  try:
                      return node.getrawtransaction(txid, True)["instantlock"]
                  except:
                      return False
          ....
          not true after 60.0 seconds

  Meanwhile, there's just no quorum for signing InstantSend, logs from nodes:

      node3 2025-05-15T19:50:54.054321Z (mocktime: 2014-12-04T18:19:47Z) [ scheduler] [llmq/signing.cpp:712] [AsyncSignIfMember] [llmq] CSigningManager::AsyncSignIfMember -- failed to select quorum. id=ce79d1f19020ec65caa8a81306362ddad6ffd0e6fc45e18c83630f401b38d54c, msgHash=83b6e8b1549ad9f2750e13e61aabdf08fd31eb1e80cbbd3729920c4c840318ae

  ## What was done?

  ## How Has This Been Tested?
  Run functional tests

  ## Breaking Changes
  N/A

  ## Checklist:
  - [x] I have performed a self-review of my own code
  - [ ] I have commented my code, particularly in hard-to-understand areas
  - [ ] I have added or updated relevant unit/integration/functional/e2e tests
  - [ ] I have made corresponding changes to the documentation
  - [x] I have assigned this pull request to a milestone _(for repository code-owners and collaborators only)_

ACKs for top commit:
  UdjinM6:
    utACK b0dea8c
  PastaPastaPasta:
    utACK b0dea8c

Tree-SHA512: e4455f859d83a7933e7dd48b0214199d98e6242f03817c64ac351bef39422a713f332540ea0fffed92785b346541a6cafdece5488b9665805384c9033a5a9cb9
@PastaPastaPasta
Copy link
Member

Have you seen any additional flakeyness? Especially in stuff like tsan?

knst added 5 commits May 27, 2025 13:44
Quorums are already generated and mined, all calculations are done.

Waiting long (0.5seconds) is not necessary
Bumping mocktime and generation new blocks no useful anymore
Same delay is used for Bitcoin Core. Though, it can be appliable
directly for each usages such as quorum generation or waiting
for IS lock. It happends because some functional tests not only
waiting during delay, but also does something strange such as
bumping mocktime or generating new blocks. Also, some works during
quorum generation are assuming to be done while we waiting, but it's
not properly validated after delay, just assumed as it is done.
@knst knst force-pushed the test-mini-delays branch from f7526ef to 0d9418e Compare May 27, 2025 06:45
@knst
Copy link
Collaborator Author

knst commented May 27, 2025

Have you seen any additional flakeyness? Especially in stuff like tsan?

I haven't noticed any extra flackiness. This PR has small scope, mostly affect p2p tests: not all delays reduced to 0.05 but just some.

on CI (github) tsan job experienced 2 tests to fail on the first attempt:

feature_llmq_connections.py failed at attempt 1/3, Duration: 143 s
feature_asset_locks.py failed at attempt 1/3, Duration: 370 s

on CI (gitlab) tsan job 4 experienced 4 tests to be re-attempted:

p2p_instantsend.py failed at attempt 1/3, Duration: 93 s <---- likely addressed by https://github.com/dashpay/dash/pull/6671
feature_governance_cl.py --legacy-wallet failed at attempt 1/3, Duration: 61 s  <---- often seen failed on gitlab
feature_governance_cl.py --descriptors failed at attempt 1/3, Duration: 63 s
p2p_invalid_block.py --v2transport failed at attempt 1/3, Duration: 5 s <---- often see failed on my localhost
p2p_node_network_limited.py --v2transport failed at attempt 1/3, Duration: 7 s <---- often seen failed on gitlab

I did force-push on top of develop to see CI run one more time.


Though, further improvement causes flackines and partially addressed by #6673, #6672, #6671
Will continue in the next PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants